const express = require('express')
//创建路由对象
const router = express.Router()
//导入路由处理函数
const check_handler = require('../router_handler/check')
//导入验证表单数据的中间件
const validator = require('../util/validator')
//导入需要验证的规则对象
const { reg_login_schema } = require('../schema/user')

//注册新用户
router.post('/reguser',validator.body(reg_login_schema),check_handler.regUser)
//登录
router.post('/login',validator.body(reg_login_schema),check_handler.login)
//退出登录
router.post('/logout', check_handler.logout)

//共享router出去
module.exports = router
